package com.kmproject.haifu.mvp.ui.activity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.InputFilter;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.blankj.utilcode.util.RegexUtils;
import com.blankj.utilcode.util.StringUtils;
import com.flyco.roundview.RoundTextView;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.DataHelper;
import com.jess.arms.widget.CustomPopupWindow;
import com.kmproject.haifu.R;
import com.kmproject.haifu.app.AppConstant;
import com.kmproject.haifu.app.EventBusTags;
import com.kmproject.haifu.app.utils.AppUtil;
import com.kmproject.haifu.app.utils.CustomGridItemDecoration;
import com.kmproject.haifu.app.utils.ExtensionUtilKt;
import com.kmproject.haifu.app.utils.GoogleLocationUtil;
import com.kmproject.haifu.di.component.DaggerReleaseRentSeekingComponent;
import com.kmproject.haifu.mvp.contract.ReleaseRentSeekingContract;
import com.kmproject.haifu.mvp.model.api.Api;
import com.kmproject.haifu.mvp.model.entity.beans.HousePayWayBean;
import com.kmproject.haifu.mvp.model.entity.beans.RentSeekingDetail;
import com.kmproject.haifu.mvp.model.entity.beans.UserBean;
import com.kmproject.haifu.mvp.model.entity.resbean.ReqParamsReleaseRentSeeking;
import com.kmproject.haifu.mvp.model.entity.resbean.SelectAddressMapBean;
import com.kmproject.haifu.mvp.presenter.ReleaseRentSeekingPresenter;
import com.kmproject.haifu.mvp.ui.adapter.BaseRecyclerAdapter;
import com.kmproject.haifu.mvp.ui.holder.SmartViewHolder;
import com.kmproject.haifu.mvp.ui.widget.CascadePickerDialog;
import com.kmproject.haifu.mvp.ui.widget.MyTextWatcher;
import com.widget.picker.PickerDateUtil;
import com.widget.picker.bis.CustomDatePickerDialog;
import com.widget.picker.bis.DataPickerDialog;

import org.simple.eventbus.EventBus;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

import butterknife.BindView;
import butterknife.OnClick;

import static com.jess.arms.utils.Preconditions.checkNotNull;
import static com.luliang.shapeutils.DevShapeUtils.getContext;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 08/05/2019 14:39
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
public class ReleaseRentSeekingActivity extends BaseActivity<ReleaseRentSeekingPresenter> implements ReleaseRentSeekingContract.View {
    @BindView(R.id.v_root_view)
    View v_root_view;
    @BindView(R.id.toolbar_back)
    RelativeLayout toolbar_back;
    @BindView(R.id.tv_release_rent_seeking_type)
    TextView tv_release_rent_seeking_type;
    @BindView(R.id.tv_release_rent_seeking_area)
    TextView tv_release_rent_seeking_area;
    @BindView(R.id.i_release_rent_seeking_apartment)
    View i_release_rent_seeking_apartment;
    @BindView(R.id.ll_release_rent_seeking_apartment)
    LinearLayout ll_release_rent_seeking_apartment;
    @BindView(R.id.tv_release_rent_seeking_apartment)
    TextView tv_release_rent_seeking_apartment;

    @BindView(R.id.tv_release_rent_seeking_requirement)
    TextView tv_release_rent_seeking_requirement;
    @BindView(R.id.ll_release_rent_seeking_move_into_date)
    LinearLayout ll_release_rent_seeking_move_into_date;
    @BindView(R.id.tv_release_rent_seeking_move_into_date)
    TextView tv_release_rent_seeking_move_into_date;
    @BindView(R.id.tv_release_rent_seeking_move_into_date_l)
    TextView tv_release_rent_seeking_move_into_date_l;

    @BindView(R.id.tv_release_rent_seeking_mouth)
    TextView tv_release_rent_seeking_mouth;

    @BindView(R.id.rtv_mr)
    RoundTextView rtv_mr;
    @BindView(R.id.rtv_ms)
    RoundTextView rtv_ms;

    @BindView(R.id.tv_select_area_code)
    TextView tv_select_area_code;

    @BindView(R.id.tv_release_rent_seeking_bottom_operation)
    TextView tv_release_rent_seeking_bottom_operation;

    @BindView(R.id.et_release_rent_seeking_address_desc)
    EditText et_release_rent_seeking_address_desc;
    @BindView(R.id.et_release_rent_seeking_min_price)
    EditText et_release_rent_seeking_min_price;
    @BindView(R.id.et_release_rent_seeking_max_price)
    EditText et_release_rent_seeking_max_price;
    @BindView(R.id.tv_release_rent_seeking_price_util)
    TextView tv_release_rent_seeking_price_util;
    @BindView(R.id.et_release_rent_seeking_lease_term)
    EditText et_release_rent_seeking_lease_term;
    @BindView(R.id.et_release_rent_seeking_house_desc)
    EditText et_release_rent_seeking_house_desc;
    @BindView(R.id.et_release_rent_seeking_name)
    EditText et_release_rent_seeking_name;
    @BindView(R.id.et_release_rent_seeking_phone)
    EditText et_release_rent_seeking_phone;
    @BindView(R.id.et_release_rent_seeking_we_chat)
    EditText et_release_rent_seeking_we_chat;

    @BindView(R.id.tv_input_limit_length)
    TextView tv_input_limit_length;

    @BindView(R.id.i_release_rent_seeking_acreage)
    View i_release_rent_seeking_acreage;
    @BindView(R.id.ll_release_rent_seeking_acreage)
    LinearLayout ll_release_rent_seeking_acreage;
    @BindView(R.id.tv_release_rent_seeking_acreage_l)
    TextView tv_release_rent_seeking_acreage_l;
    @BindView(R.id.tv_release_rent_seeking_acreage)
    TextView tv_release_rent_seeking_acreage;

    @BindView(R.id.i_release_rent_seeking_lease_capacity)
    View i_release_rent_seeking_lease_capacity;
    @BindView(R.id.ll_release_rent_seeking_lease_capacity)
    LinearLayout ll_release_rent_seeking_lease_capacity;
    @BindView(R.id.et_release_rent_seeking_capacity)
    EditText et_release_rent_seeking_capacity;

    @BindView(R.id.ll_house_requirement)
    LinearLayout ll_house_requirement;
    @BindView(R.id.rv_house_requirement)
    RecyclerView rv_house_requirement;
    private BaseRecyclerAdapter<HousePayWayBean> yqAdapter;
    private List<HousePayWayBean> selectedYq = new ArrayList<>();
    private ReqParamsReleaseRentSeeking reqParamsReleaseRentSeeking;

    //年月日数据
    private List<String> mouthData = new ArrayList<>();
    private List<String> leasePeriodData = new ArrayList<>();

    private String typeName;
    //    private String typeId;
    private String category;
    private List<HousePayWayBean> typeBeans;
    private List<String> typeNameList;
    private String lat;
    private String lng;
    private List<String> acreageList;
    private String seekingId;

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerReleaseRentSeekingComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .view(this)
                .build()
                .inject(this);
    }

    @RequiresApi(api = Build.VERSION_CODES.KITKAT)
    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_release_rent_seeking; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        //设置底部导航栏不会遮挡布局
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
        super.onCreate(savedInstanceState);
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        Intent intent = getIntent();
        if (intent != null) {
            seekingId = intent.getStringExtra("seekingId");
            if (StringUtils.isEmpty(seekingId)) {
                typeName = intent.getStringExtra("typeName");
                if (!StringUtils.isEmpty(typeName)) {
                    tv_release_rent_seeking_type.setText(typeName);
                }
//                typeId = intent.getStringExtra("typeId");
                category = intent.getStringExtra("category");
            }
        }

        reqParamsReleaseRentSeeking = new ReqParamsReleaseRentSeeking();
        tv_release_rent_seeking_type.postDelayed(() -> GoogleLocationUtil.getInstance(ReleaseRentSeekingActivity.this)
                .setOnLocationFinishListener(new GoogleLocationUtil.OnLocationFinishListener() {
                    @Override
                    public void locationFinish(SelectAddressMapBean locateCity) {
                        if (locateCity != null) {
                            lat = locateCity.getLat();
                            lng = locateCity.getLgt();
                            reqParamsReleaseRentSeeking.setLat(lat);
                            reqParamsReleaseRentSeeking.setLgt(lng);
                        }
                    }

                    @Override
                    public void fail(String message) {

                    }
                }).startLocation(), 50);
        /*--设置默认值--*/
        reqParamsReleaseRentSeeking.setEstimateRentingUnit("month");
        reqParamsReleaseRentSeeking.setTenancy("short");
        reqParamsReleaseRentSeeking.setLandlordGender("男");

        addEditTextChanged();

        rv_house_requirement.addItemDecoration(new CustomGridItemDecoration.Builder(Objects.requireNonNull(getContext())).setVerticalSpan(10f).
                setHorizontalSpan(10f).setColor(ContextCompat.getColor(getContext(), R.color.white)).setShowLastLine(false).build());
        ArmsUtils.configRecyclerView(rv_house_requirement, new GridLayoutManager(this, 4));
        rv_house_requirement.setItemAnimator(new DefaultItemAnimator());

        yqAdapter = new BaseRecyclerAdapter<HousePayWayBean>(R.layout.item_release_room_feature) {
            @Override
            protected void onBindViewHolder(SmartViewHolder holder, HousePayWayBean model, int position) {
                RoundTextView textView = (RoundTextView) holder.findViewById(R.id.rtv_unique_feature);
                if (isContainsSelectedList(model.getDictId()) != -1) {
                    textView.getDelegate().setBackgroundColor(ContextCompat.getColor(ReleaseRentSeekingActivity.this, R.color.color_F9D35A));
                    textView.setTextColor(ContextCompat.getColor(ReleaseRentSeekingActivity.this, R.color.common_title_text));
                } else {
                    textView.getDelegate().setBackgroundColor(ContextCompat.getColor(ReleaseRentSeekingActivity.this, R.color.color_AAAAAA));
                    textView.setTextColor(ContextCompat.getColor(ReleaseRentSeekingActivity.this, R.color.white));
                }
                textView.setText(model.getName());
            }
        };
        rv_house_requirement.setAdapter(yqAdapter);

        yqAdapter.setOnItemClickListener((parent, view, position, id) -> {
            HousePayWayBean bean = (HousePayWayBean) yqAdapter.getItem(position);
            int index = isContainsSelectedList(bean.getDictId());
            if (index != -1) {
                selectedYq.remove(index);
            } else {
                selectedYq.add(bean);
            }
            yqAdapter.notifyDataSetChanged();
            yqAdapter.notifyListDataSetChanged();
        });

        et_release_rent_seeking_address_desc.setFilters(new InputFilter[]{new InputFilter.LengthFilter(20)});
        et_release_rent_seeking_min_price.setFilters(new InputFilter[]{new InputFilter.LengthFilter(10)});
        et_release_rent_seeking_max_price.setFilters(new InputFilter[]{new InputFilter.LengthFilter(10)});
        et_release_rent_seeking_lease_term.setFilters(new InputFilter[]{new InputFilter.LengthFilter(19)});
        et_release_rent_seeking_house_desc.setFilters(new InputFilter[]{new InputFilter.LengthFilter(500)});
        et_release_rent_seeking_name.setFilters(new InputFilter[]{new InputFilter.LengthFilter(30)});
        et_release_rent_seeking_we_chat.setFilters(new InputFilter[]{new InputFilter.LengthFilter(30)});
        et_release_rent_seeking_capacity.setFilters(new InputFilter[]{new InputFilter.LengthFilter(10)});

        if (StringUtils.isEmpty(seekingId)) {
            getHouseRequirement(category);
            UserBean userBean = DataHelper.getDeviceData(this, AppConstant.USER_INFO);
            if (!StringUtils.isTrimEmpty(userBean.getMobile())) {
                String[] strings = ExtensionUtilKt.handleMobile(userBean.getMobile());
                tv_select_area_code.setText("+" + strings[0]);
                et_release_rent_seeking_phone.setText(strings[1]);
            }
        } else {
            assert mPresenter != null;
            mPresenter.getDetail(seekingId);
        }
    }

    private int isContainsSelectedList(String id) {
        for (int i = 0; i < selectedYq.size(); i++) {
            if (id.equals(selectedYq.get(i).getDictId())) {
                return i;
            }
        }
        return -1;
    }

    private void addEditTextChanged() {
        et_release_rent_seeking_address_desc.addTextChangedListener(new MyTextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                reqParamsReleaseRentSeeking.setPositionDescription(s.toString());
            }
        });
        et_release_rent_seeking_lease_term.addTextChangedListener(new MyTextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                if (s.length() > 0) {
                    reqParamsReleaseRentSeeking.setEstimateRentingTime(Long.parseLong(s.toString()));
                } else {
                    reqParamsReleaseRentSeeking.setEstimateRentingTime(0);
                }
            }
        });
        et_release_rent_seeking_house_desc.addTextChangedListener(new MyTextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                tv_input_limit_length.setText(String.format(getString(R.string.release_rent_seeking_14), s.length()));
                reqParamsReleaseRentSeeking.setDetailDesc(s.toString());
            }
        });


        et_release_rent_seeking_min_price.addTextChangedListener(new MyTextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                if (s.length() > 0) {
                    reqParamsReleaseRentSeeking.setLowestRentBudget(Long.parseLong(s.toString()));
                } else {
                    reqParamsReleaseRentSeeking.setLowestRentBudget(0);
                }
            }
        });
        et_release_rent_seeking_max_price.addTextChangedListener(new MyTextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                if (s.length() > 0) {
                    reqParamsReleaseRentSeeking.setHighestRentBudget(Long.parseLong(s.toString()));
                } else {
                    reqParamsReleaseRentSeeking.setHighestRentBudget(0);
                }
            }
        });
        et_release_rent_seeking_name.addTextChangedListener(new MyTextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                reqParamsReleaseRentSeeking.setLandlord(s.toString());
            }
        });
        et_release_rent_seeking_phone.addTextChangedListener(new MyTextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                reqParamsReleaseRentSeeking.setLandlordMobile(s.toString());
            }
        });
        et_release_rent_seeking_we_chat.addTextChangedListener(new MyTextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                if (s.length() > 0) {
                    for (int i = 0; i < s.length(); i++) {
                        char c = s.charAt(i);
                        if (c >= 0x4e00 && c <= 0X9fff) {
                            s.delete(i, i + 1);
                        }
                    }
                    reqParamsReleaseRentSeeking.setWechatNumber(s.toString());
                } else {
                    reqParamsReleaseRentSeeking.setWechatNumber(null);
                }
            }
        });
        et_release_rent_seeking_capacity.addTextChangedListener(new MyTextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                if (s.length() > 0) {
                    reqParamsReleaseRentSeeking.setAccommodationStation(Long.parseLong(s.toString()));
                } else {
                    reqParamsReleaseRentSeeking.setAccommodationStation(0);
                }
            }
        });
    }

    private void getHouseRequirement(String ctr) {
        reqParamsReleaseRentSeeking.setSeekingType(category);
        if (!StringUtils.isEmpty(ctr)) {
            switch (ctr) {
                case "zz":
                    i_release_rent_seeking_acreage.setVisibility(View.GONE);
                    ll_release_rent_seeking_acreage.setVisibility(View.GONE);
                    tv_release_rent_seeking_move_into_date_l.setText(getString(R.string.release_rent_seeking_7));
                    i_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    ll_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    i_release_rent_seeking_apartment.setVisibility(View.VISIBLE);
                    ll_release_rent_seeking_apartment.setVisibility(View.VISIBLE);
                    assert mPresenter != null;
                    mPresenter.getHouseRequirement((Api.HOUSE_RENT_SEEKING_DETAIL_ + ctr).toUpperCase(), "3", houseYq);
                    break;
                case "hz":
                    acreageList = Arrays.asList(getResources().getStringArray(R.array.acreage_hz));
                    i_release_rent_seeking_acreage.setVisibility(View.VISIBLE);
                    ll_release_rent_seeking_acreage.setVisibility(View.VISIBLE);
                    tv_release_rent_seeking_acreage_l.setText(getString(R.string.release_rent_seeking_21));
                    tv_release_rent_seeking_move_into_date_l.setText(getString(R.string.release_rent_seeking_7));
                    i_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    ll_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    i_release_rent_seeking_apartment.setVisibility(View.GONE);
                    ll_release_rent_seeking_apartment.setVisibility(View.GONE);
                    assert mPresenter != null;
                    mPresenter.getHouseRequirement((Api.HOUSE_RENT_SEEKING_DETAIL_ + ctr).toUpperCase(), "3", houseYq);
                    break;
                case "bs":
                    i_release_rent_seeking_acreage.setVisibility(View.GONE);
                    ll_release_rent_seeking_acreage.setVisibility(View.GONE);
                    tv_release_rent_seeking_move_into_date_l.setText(getString(R.string.release_rent_seeking_7));
                    i_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    ll_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    i_release_rent_seeking_apartment.setVisibility(View.VISIBLE);
                    ll_release_rent_seeking_apartment.setVisibility(View.VISIBLE);
                    assert mPresenter != null;
                    mPresenter.getHouseRequirement((Api.HOUSE_RENT_SEEKING_DETAIL_ + ctr).toUpperCase(), "3", houseYq);
                    break;
                case "bgs":
                    acreageList = Arrays.asList(getResources().getStringArray(R.array.acreage_bgs));
                    i_release_rent_seeking_acreage.setVisibility(View.VISIBLE);
                    ll_release_rent_seeking_acreage.setVisibility(View.VISIBLE);
                    tv_release_rent_seeking_acreage_l.setText(getString(R.string.release_rent_seeking_23));
                    tv_release_rent_seeking_move_into_date_l.setText(getString(R.string.release_rent_seeking_25));
                    i_release_rent_seeking_lease_capacity.setVisibility(View.VISIBLE);
                    ll_release_rent_seeking_lease_capacity.setVisibility(View.VISIBLE);
                    i_release_rent_seeking_apartment.setVisibility(View.GONE);
                    ll_release_rent_seeking_apartment.setVisibility(View.GONE);
                    assert mPresenter != null;
                    mPresenter.getHouseRequirement((Api.HOUSE_RENT_SEEKING_DETAIL_ + ctr).toUpperCase(), "3", houseYq);
                    break;
                case "sp":
                    acreageList = Arrays.asList(getResources().getStringArray(R.array.acreage_sp));
                    i_release_rent_seeking_acreage.setVisibility(View.VISIBLE);
                    ll_release_rent_seeking_acreage.setVisibility(View.VISIBLE);
                    tv_release_rent_seeking_acreage_l.setText(getString(R.string.release_rent_seeking_22));
                    tv_release_rent_seeking_move_into_date_l.setText(getString(R.string.release_rent_seeking_25));
                    ll_house_requirement.setVisibility(View.GONE);
                    i_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    ll_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    i_release_rent_seeking_apartment.setVisibility(View.GONE);
                    ll_release_rent_seeking_apartment.setVisibility(View.GONE);
                    break;
                case "cw":
                    i_release_rent_seeking_acreage.setVisibility(View.GONE);
                    ll_release_rent_seeking_acreage.setVisibility(View.GONE);
                    tv_release_rent_seeking_move_into_date_l.setText(getString(R.string.release_rent_seeking_25));
                    ll_house_requirement.setVisibility(View.GONE);
                    i_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    ll_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    i_release_rent_seeking_apartment.setVisibility(View.GONE);
                    ll_release_rent_seeking_apartment.setVisibility(View.GONE);
                    break;
                case "cfck":
                    acreageList = Arrays.asList(getResources().getStringArray(R.array.acreage_ck));
                    i_release_rent_seeking_acreage.setVisibility(View.VISIBLE);
                    ll_release_rent_seeking_acreage.setVisibility(View.VISIBLE);
                    tv_release_rent_seeking_acreage_l.setText(getString(R.string.release_rent_seeking_23));
                    tv_release_rent_seeking_move_into_date_l.setText(getString(R.string.release_rent_seeking_25));
                    ll_house_requirement.setVisibility(View.GONE);
                    i_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    ll_release_rent_seeking_lease_capacity.setVisibility(View.GONE);
                    i_release_rent_seeking_apartment.setVisibility(View.GONE);
                    ll_release_rent_seeking_apartment.setVisibility(View.GONE);
                    break;
            }
        }
    }

    @OnClick({R.id.tv_release_rent_seeking_type, R.id.tv_release_rent_seeking_area, R.id.tv_release_rent_seeking_apartment, R.id.tv_release_rent_seeking_requirement, R.id.tv_release_rent_seeking_acreage,
            R.id.ll_release_rent_seeking_move_into_date, R.id.tv_release_rent_seeking_mouth, R.id.rtv_mr, R.id.rtv_ms, R.id.tv_select_area_code, R.id.tv_release_rent_seeking_bottom_operation, R.id.toolbar_back})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_release_rent_seeking_type:
                assert mPresenter != null;
                mPresenter.getReleaseType(typeBeans);
                break;
            case R.id.toolbar_back:
                killMyself();
                break;
            case R.id.tv_release_rent_seeking_area:
                //所在区域
                assert mPresenter != null;
                mPresenter.getHouseArea(Api.HOUSE_AREA, houseArea);
                break;
            case R.id.tv_release_rent_seeking_apartment:
                assert mPresenter != null;
                mPresenter.getApartmentRoom(Api.ROOM_COUNT, "", houseHxS);
                break;
            case R.id.tv_release_rent_seeking_requirement:
                if (leasePeriodData.isEmpty()) {
                    leasePeriodData.add(getString(R.string.lease_period_1));
                    leasePeriodData.add(getString(R.string.lease_period_2));
                }
                ExtensionUtilKt.showDataPw(this, getString(R.string.release_rent_seeking_19), leasePeriodData, 0, new DataPickerDialog.OnDataSelectedListener() {
                    @Override
                    public void onDataSelected(String itemValue, int position) {
                        tv_release_rent_seeking_requirement.setText(itemValue);
                        if (itemValue.equals(getString(R.string.lease_period_2))) {
                            tv_release_rent_seeking_price_util.setText(getString(R.string.release_rent_seeking_17));
                            reqParamsReleaseRentSeeking.setTenancy("short");
                            reqParamsReleaseRentSeeking.setEstimateRentingUnit("day");
                            tv_release_rent_seeking_mouth.setText(getString(R.string.day));
                        } else {
                            tv_release_rent_seeking_price_util.setText(getString(R.string.release_rent_seeking_16));
                            reqParamsReleaseRentSeeking.setTenancy("lasting");
                            reqParamsReleaseRentSeeking.setEstimateRentingUnit("month");
                            tv_release_rent_seeking_mouth.setText(getString(R.string.mouth));
                        }
                    }

                    @Override
                    public void onCancel() {
                        ArmsUtils.makeText(ReleaseRentSeekingActivity.this, getString(R.string.cancel));
                    }
                });
                break;
            case R.id.ll_release_rent_seeking_move_into_date:
                ExtensionUtilKt.showDateDialog(this, PickerDateUtil.getDateForString(PickerDateUtil.getToday()), new CustomDatePickerDialog.OnDateSelectedListener() {
                    @Override
                    public void onDateSelected(int[] dates) {
                        StringBuilder sb = new StringBuilder();
                        sb.append(dates[0]);
                        sb.append("-");
                        if (dates[1] > 9) {
                            sb.append(dates[1]);
                        } else {
                            sb.append("0").append(dates[1]);
                        }
                        sb.append("-");
                        if (dates[2] > 9) {
                            sb.append(dates[2]);
                        } else {
                            sb.append("0").append(dates[2]);
                        }
//                sb.append(" ").append(PickerDateUtil.getCurrentTime());
                        tv_release_rent_seeking_move_into_date.setText(sb.toString());
//                reqParamsReleaseRentSeeking.setCheckInTime(sb.append(" ").append(PickerDateUtil.getCurrentTime()).toString());
                        reqParamsReleaseRentSeeking.setRentTime(PickerDateUtil.appendDefTime(sb.toString()));
                    }

                    @Override
                    public void onCancel() {
                        ArmsUtils.makeText(ReleaseRentSeekingActivity.this, getString(R.string.cancel));
                    }
                });
                break;
            case R.id.tv_release_rent_seeking_mouth:
                if (mouthData.isEmpty()) {
                    mouthData.add(getString(R.string.day));
                    mouthData.add(getString(R.string.mouth));
                    mouthData.add(getString(R.string.year));
                }
                ExtensionUtilKt.showDataPw(this, getString(R.string.release_rent_seeking_18), mouthData, 1, new DataPickerDialog.OnDataSelectedListener() {
                    @Override
                    public void onDataSelected(String itemValue, int position) {
                        tv_release_rent_seeking_mouth.setText(itemValue);
                        switch (position) {
                            case 0:
                                reqParamsReleaseRentSeeking.setEstimateRentingUnit("day");
                                break;
                            case 1:
                                reqParamsReleaseRentSeeking.setEstimateRentingUnit("month");
                                break;
                            case 2:
                                reqParamsReleaseRentSeeking.setEstimateRentingUnit("year");
                                break;
                            default:
                                reqParamsReleaseRentSeeking.setEstimateRentingUnit("month");
                        }
                    }

                    @Override
                    public void onCancel() {
                        ArmsUtils.makeText(ReleaseRentSeekingActivity.this, getString(R.string.cancel));
                    }
                });
                break;
            case R.id.rtv_mr:
                setSexFlag(R.id.rtv_mr);
                break;
            case R.id.rtv_ms:
                setSexFlag(R.id.rtv_ms);
                break;
            case R.id.tv_select_area_code:
                showPopupWindow();
                break;
            case R.id.tv_release_rent_seeking_acreage:
                ExtensionUtilKt.showDataPw(this, getString(R.string.release_rent_seeking_26), acreageList, 0, new DataPickerDialog.OnDataSelectedListener() {
                    @Override
                    public void onDataSelected(String itemValue, int position) {
                        tv_release_rent_seeking_acreage.setText(itemValue);
                        int[] res = ExtensionUtilKt.handleAcreage(itemValue, ReleaseRentSeekingActivity.this);
//                        showMessage(res[0] + "-" + res[1]);
                        reqParamsReleaseRentSeeking.setLowestAcreage(res[0]);
                        reqParamsReleaseRentSeeking.setHighestAcreage(res[1]);
                    }

                    @Override
                    public void onCancel() {
                        ArmsUtils.makeText(ReleaseRentSeekingActivity.this, getString(R.string.cancel));
                    }
                });
                break;
            case R.id.tv_release_rent_seeking_bottom_operation:
                assemblyParameters();
                if (checkParameters()) {
                    assert mPresenter != null;
                    showLoading();
                    if (StringUtils.isEmpty(seekingId)) {
                        mPresenter.release(reqParamsReleaseRentSeeking);
                    } else {
                        mPresenter.updateRentSeeking(seekingId, reqParamsReleaseRentSeeking);
                    }
                }
                break;
        }
    }

    private void assemblyParameters() {
        List<ReqParamsReleaseRentSeeking.HouseRentDetailListBean> houseRentDetailList = new ArrayList<>();
        ReqParamsReleaseRentSeeking.HouseRentDetailListBean houseRentDetailListBean;
        for (int i = 0; i < selectedYq.size(); i++) {
            houseRentDetailListBean = new ReqParamsReleaseRentSeeking.HouseRentDetailListBean();
            houseRentDetailListBean.setBaseDictId(selectedYq.get(i).getDictId());
            houseRentDetailListBean.setCategory(selectedYq.get(i).getCategory());
            houseRentDetailList.add(houseRentDetailListBean);
        }
        reqParamsReleaseRentSeeking.setHouseRentDetailList(houseRentDetailList);

        reqParamsReleaseRentSeeking.setLandlordMobile(tv_select_area_code.getText().toString().replace("+", "")
                + reqParamsReleaseRentSeeking.getLandlordMobile());
    }

    private boolean checkParameters() {
        if (reqParamsReleaseRentSeeking.getSeekingArea() == 0) {
            selectPmt1(getString(R.string.release_rent_seeking_2));
            return false;
        }
        if (StringUtils.isEmpty(reqParamsReleaseRentSeeking.getPositionDescription())) {
            selectPmt2(getString(R.string.release_rent_seeking_3));
            return false;
        }
        if (reqParamsReleaseRentSeeking.getLowestRentBudget() == 0
                || reqParamsReleaseRentSeeking.getHighestRentBudget() == 0) {
            selectPmt2(getString(R.string.release_rent_seeking_6));
            return false;
        }
        if (reqParamsReleaseRentSeeking.getLowestRentBudget() >= reqParamsReleaseRentSeeking.getHighestRentBudget()) {
            selectPmt2(getString(R.string.release_rent_seeking_pmt_3));
            return false;
        }
        if (StringUtils.isEmpty(reqParamsReleaseRentSeeking.getRentTime())) {
            selectPmt1(tv_release_rent_seeking_move_into_date_l.getText().toString());
            return false;
        }
        try {
            if (PickerDateUtil.isPastDay(reqParamsReleaseRentSeeking.getRentTime())) {
                selectPmt1(tv_release_rent_seeking_move_into_date_l.getText().toString() + "必须大于等于今天");
                return false;
            }
        } catch (ParseException e) {
            return false;
        }
        if (reqParamsReleaseRentSeeking.getEstimateRentingTime() == 0) {
            selectPmt2(getString(R.string.release_rent_seeking_8));
            return false;
        }
        if (StringUtils.isEmpty(reqParamsReleaseRentSeeking.getDetailDesc())) {
            selectPmt2(getString(R.string.release_rent_seeking_10));
            return false;
        }
        if (StringUtils.isEmpty(reqParamsReleaseRentSeeking.getLandlord())) {
            selectPmt2(getString(R.string.release_rent_seeking_11));
            return false;
        }
        if (StringUtils.isEmpty(reqParamsReleaseRentSeeking.getLandlordMobile())) {
            selectPmt2(getString(R.string.release_rent_seeking_12));
            return false;
        }
        if (tv_select_area_code.getText().toString().equals("+63")) {
            if (et_release_rent_seeking_phone.getText().toString().substring(0, 1).equals("0")) {
                selectPmt1(getString(R.string.release_rent_seeking_pmt_4));
                return false;
            }
            if (!et_release_rent_seeking_phone.getText().toString().substring(0, 1).equals("9")) {
                selectPmt1(getString(R.string.release_rent_seeking_pmt_5));
                return false;
            }
            if (et_release_rent_seeking_phone.getText().toString().length() != 10) {
                selectPmt1(getString(R.string.release_rent_seeking_pmt_6));
                return false;
            }
        } else {
            if (et_release_rent_seeking_phone.getText().toString().length() != 11) {
                selectPmt1(getString(R.string.release_rent_seeking_pmt_7));
                return false;
            }
            if (!RegexUtils.isMobileExact(et_release_rent_seeking_phone.getText().toString())) {
                selectPmt1("请输入正确是的手机号");
                return false;
            }
        }
        if (StringUtils.isEmpty(reqParamsReleaseRentSeeking.getWechatNumber())) {
            selectPmt2(getString(R.string.release_rent_seeking_13));
            return false;
        }

        if (!StringUtils.isEmpty(category)) {
            switch (category) {
                case "zz":
                    if (reqParamsReleaseRentSeeking.getRoomCount() == 0
                            || reqParamsReleaseRentSeeking.getDrawingCount() == 0
                            || reqParamsReleaseRentSeeking.getToiletCount() == 0) {
                        selectPmt1(getString(R.string.release_rent_seeking_4));
                        return false;
                    }
                    break;
                case "hz":
//                    if (StringUtils.isEmpty(reqParamsReleaseRentSeeking.getAcreage())) {
//                        selectPmt1(tv_release_rent_seeking_acreage_l.getText().toString());
//                        return false;
//                    }
                    break;
                case "bs":
                    if (reqParamsReleaseRentSeeking.getRoomCount() == 0
                            || reqParamsReleaseRentSeeking.getDrawingCount() == 0
                            || reqParamsReleaseRentSeeking.getToiletCount() == 0) {
                        selectPmt1(getString(R.string.release_rent_seeking_4));
                        return false;
                    }
                    break;
                case "bgs":
//                    if (StringUtils.isEmpty(reqParamsReleaseRentSeeking.getAcreage())) {
//                        selectPmt1(tv_release_rent_seeking_acreage_l.getText().toString());
//                        return false;
//                    }
                    if (reqParamsReleaseRentSeeking.getAccommodationStation() == 0) {
                        selectPmt2(getString(R.string.release_rent_seeking_24));
                        return false;
                    }
                    break;
                case "sp":
//                    if (StringUtils.isEmpty(reqParamsReleaseRentSeeking.getAcreage())) {
//                        selectPmt1(tv_release_rent_seeking_acreage_l.getText().toString());
//                        return false;
//                    }
                    break;
                case "cw":
                    break;
                case "cfck":
//                    if (StringUtils.isEmpty(reqParamsReleaseRentSeeking.getAcreage())) {
//                        selectPmt1(tv_release_rent_seeking_acreage_l.getText().toString());
//                        return false;
//                    }
                    break;
            }
        }
        return true;
    }

    private void selectPmt1(String msg) {
//        ArmsUtils.makeText(this, String.format(getString(R.string.release_rent_seeking_pmt_fm_1), msg));
        showMessage(String.format(getString(R.string.release_rent_seeking_pmt_fm_1), msg));
    }

    private void selectPmt2(String msg) {
//        ArmsUtils.makeText(this, String.format(getString(R.string.release_rent_seeking_pmt_fm_2), msg));
        showMessage(String.format(getString(R.string.release_rent_seeking_pmt_fm_2), msg));
    }

    private List<HousePayWayBean> houseYq;//房屋要求
    private List<HousePayWayBean> houseHxS;//户型室
    private List<HousePayWayBean> houseHxT;//户型厅
    private List<HousePayWayBean> houseHxW;//户型卫

    private List<HousePayWayBean> houseArea;//区域

    @Override
    public void getApartmentRoomSuccess(List<HousePayWayBean> housePayWayBeans) {
        houseHxS = housePayWayBeans;
        assert mPresenter != null;
        mPresenter.getApartmentDrawing(Api.DRAWING_COUNT, "", houseHxT);
    }

    @Override
    public void getApartmentDrawingSuccess(List<HousePayWayBean> housePayWayBeans) {
        houseHxT = housePayWayBeans;
        assert mPresenter != null;
        mPresenter.getApartmentToilet(Api.TOILET_COUNT, "", houseHxW);
    }

    @Override
    public void getApartmentToiletSuccess(List<HousePayWayBean> housePayWayBeans) {
        houseHxW = housePayWayBeans;
        showApartmentList();
    }

    private void showApartmentList() {
        CascadePickerDialog.Builder builder = new CascadePickerDialog.Builder(this);
        builder.setTitle(getString(R.string.dilaog_titile_xztssj_txt))
                .setData1(houseHxS)
                .setData2(houseHxT)
                .setData3(houseHxW)
                .setSelection1(0)
                .setSelection2(0)
                .setSelection3(0)
                .setOnRegionSelectedListener(new CascadePickerDialog.OnRegionSelectedListener() {
                    @Override
                    public void onRegionSelected(List<HousePayWayBean> itemValues) {
                        StringBuilder sb = new StringBuilder();
                        for (HousePayWayBean bean : itemValues) {
                            sb.append(bean.getName()).append("-");
                        }
                        if (sb.length() > 0) {
                            sb.deleteCharAt(sb.length() - 1);
                            tv_release_rent_seeking_apartment.setText(sb.toString());
                        }
                        if (itemValues.size() > 0) {
//                            room = itemValues.get(0).getName();//房间
//                            if (room.length() > 1) {
//                                room = room.substring(0, room.length() - 1);
//                            }
                            reqParamsReleaseRentSeeking.setRoomCount(Long.parseLong(itemValues.get(0).getDictId()));
                        } else {
                            reqParamsReleaseRentSeeking.setRoomCount(0);
                        }
                        if (itemValues.size() > 1) {
                            reqParamsReleaseRentSeeking.setDrawingCount(Long.parseLong(itemValues.get(1).getDictId()));
                        } else {
                            reqParamsReleaseRentSeeking.setDrawingCount(0);
                        }
                        if (itemValues.size() > 2) {
                            reqParamsReleaseRentSeeking.setToiletCount(Long.parseLong(itemValues.get(2).getDictId()));
                        } else {
                            reqParamsReleaseRentSeeking.setToiletCount(0);
                        }
                    }

                    @Override
                    public void onCancel() {
                        ArmsUtils.makeText(ReleaseRentSeekingActivity.this, getString(R.string.cancel));
                    }
                })
                .create()
                .show();
    }

    @Override
    public void getHouseRequirementSuccess(List<HousePayWayBean> housePayWayBeans) {
        if (housePayWayBeans != null && housePayWayBeans.size() > 0) {
            ll_house_requirement.setVisibility(View.VISIBLE);
            houseYq = housePayWayBeans;
            yqAdapter.refresh(houseYq);
        } else {
            ll_house_requirement.setVisibility(View.GONE);
        }
    }

    @Override
    public void getHouseArea(List<HousePayWayBean> housePayWayBeans) {
        this.houseArea = housePayWayBeans;
        if (this.houseArea.size() > 0) {

            CascadePickerDialog.Builder builder = new CascadePickerDialog.Builder(this);
            builder.setTitle(getString(R.string.dilaog_titile_xzszqy_txt))
                    .setData1(this.houseArea);
            if (this.houseArea.get(0) != null && this.houseArea.get(0).getChildren() != null && this.houseArea.get(0).getChildren().size() > 0) {
                builder.setData2(this.houseArea.get(0).getChildren());
            }
            if (this.houseArea.get(0) != null && this.houseArea.get(0).getChildren() != null && this.houseArea.get(0).getChildren().size() > 0
                    && this.houseArea.get(0).getChildren().get(0) != null && this.houseArea.get(0).getChildren().get(0).getChildren().size() > 0) {
                builder.setData3(this.houseArea.get(0).getChildren().get(0).getChildren());
            }
            builder.setSelection1(0)
                    .setSelection2(0)
                    .setSelection3(0)
                    .setCascade(true)
                    .setOnRegionSelectedListener(new CascadePickerDialog.OnRegionSelectedListener() {
                        @Override
                        public void onRegionSelected(List<HousePayWayBean> itemValues) {
                            StringBuilder sb = new StringBuilder();
                            for (HousePayWayBean bean : itemValues) {
                                sb.append(bean.getName());
                            }
                            if (sb.length() > 0) {
                                tv_release_rent_seeking_area.setText(sb.toString());
                            }
                            HousePayWayBean item = itemValues.get(itemValues.size() - 1);
                            reqParamsReleaseRentSeeking.setSeekingArea(Long.parseLong(item.getDictId()));
                        }

                        @Override
                        public void onCancel() {
                            ArmsUtils.makeText(ReleaseRentSeekingActivity.this, getString(R.string.cancel));
                        }
                    })
                    .create()
                    .show();
        }
    }

    @Override
    public void getReleaseTypeSuccess(List<HousePayWayBean> housePayWayBeans) {
        typeBeans = housePayWayBeans;
        if (typeNameList == null) {
            typeNameList = new ArrayList<>();
        }
        typeNameList.clear();
        for (int i = 0; i < typeBeans.size(); i++) {
            typeNameList.add(typeBeans.get(i).getName());
        }
        ExtensionUtilKt.showDataPw(this, getString(R.string.release_rent_seeking_20), typeNameList, 0, new DataPickerDialog.OnDataSelectedListener() {
            @Override
            public void onDataSelected(String itemValue, int position) {
                HousePayWayBean bean = typeBeans.get(position);
                typeName = itemValue;
                tv_release_rent_seeking_type.setText(typeName);
//                typeId = bean.getDictId();
                category = bean.getCategory();
                getHouseRequirement(category);
            }

            @Override
            public void onCancel() {
                ArmsUtils.makeText(ReleaseRentSeekingActivity.this, getString(R.string.cancel));
            }
        });
    }

    /**
     * 控制popu显示
     */
    public void showPopupWindow() {
        CustomPopupWindow customPopupWindow = new CustomPopupWindow.Builder().contentView(CustomPopupWindow.inflateView(this, R.layout.user_popuwindow_view))
                .parentView(tv_select_area_code).backgroundDrawable(getResources().getDrawable(R.drawable.button_white_bg))
                .animationStyle(R.style.mypopwindow_anim_style).customListener(contentView -> {
                }).isWrap(true).isHaveBackGround(true).build();
        View view1 = customPopupWindow.getContentView();
        TextView user_popuwindow_view_flb = view1.findViewById(R.id.user_popuwindow_view_flb);
        TextView user_popuwindow_view_zg = view1.findViewById(R.id.user_popuwindow_view_zg);
        user_popuwindow_view_flb.setOnClickListener(v -> {
            tv_select_area_code.setText("+63");
            customPopupWindow.dismiss();
        });
        user_popuwindow_view_zg.setOnClickListener(v -> {
            tv_select_area_code.setText("+86");
            customPopupWindow.dismiss();
        });
        customPopupWindow.show();
    }

    private void setSexFlag(int viewId) {
        /*男-先生；女-女士*/
        if (viewId == R.id.rtv_ms) {
            rtv_mr.getDelegate().setBackgroundColor(ContextCompat.getColor(this, R.color.color_AAAAAA));
            rtv_mr.setTextColor(ContextCompat.getColor(this, R.color.white));
            rtv_ms.getDelegate().setBackgroundColor(ContextCompat.getColor(this, R.color.color_F9D35A));
            rtv_ms.setTextColor(ContextCompat.getColor(this, R.color.common_title_text));
            reqParamsReleaseRentSeeking.setLandlordGender("女");
        } else {
            rtv_ms.getDelegate().setBackgroundColor(ContextCompat.getColor(this, R.color.color_AAAAAA));
            rtv_ms.setTextColor(ContextCompat.getColor(this, R.color.white));
            rtv_mr.getDelegate().setBackgroundColor(ContextCompat.getColor(this, R.color.color_F9D35A));
            rtv_mr.setTextColor(ContextCompat.getColor(this, R.color.common_title_text));
            reqParamsReleaseRentSeeking.setLandlordGender("男");
        }
    }


    private void setSexView(String sex) {
        /*男-先生；女-女士*/
        if ("女".equals(sex)) {
            rtv_mr.getDelegate().setBackgroundColor(ContextCompat.getColor(this, R.color.color_AAAAAA));
            rtv_mr.setTextColor(ContextCompat.getColor(this, R.color.white));
            rtv_ms.getDelegate().setBackgroundColor(ContextCompat.getColor(this, R.color.color_F9D35A));
            rtv_ms.setTextColor(ContextCompat.getColor(this, R.color.common_title_text));
            reqParamsReleaseRentSeeking.setLandlordGender("女");
        } else {
            rtv_ms.getDelegate().setBackgroundColor(ContextCompat.getColor(this, R.color.color_AAAAAA));
            rtv_ms.setTextColor(ContextCompat.getColor(this, R.color.white));
            rtv_mr.getDelegate().setBackgroundColor(ContextCompat.getColor(this, R.color.color_F9D35A));
            rtv_mr.setTextColor(ContextCompat.getColor(this, R.color.common_title_text));
            reqParamsReleaseRentSeeking.setLandlordGender("男");
        }
    }

    @Override
    public void releaseSuccess(RentSeekingDetail rentSeekingDetail) {
        hideLoading();
        CustomPopupWindow customPopupWindow = AppUtil.showPopuWindow(this, CustomPopupWindow.inflateView(this, R.layout.custom_popuwindow_dialog), v_root_view);
        View view = customPopupWindow.getContentView();
        TextView membercenter_popuwindow_dialog_txt1 = view.findViewById(R.id.membercenter_popuwindow_dialog_txt1);
        TextView membercenter_popuwindow_dialog_txt2 = view.findViewById(R.id.membercenter_popuwindow_dialog_txt2);
        membercenter_popuwindow_dialog_txt1.setOnClickListener(v -> {
            killMyself();//继续发布
        });
        membercenter_popuwindow_dialog_txt2.setOnClickListener(v -> {
            Intent intent = new Intent(ReleaseRentSeekingActivity.this, MyCollectionActivity.class);
            intent.putExtra("selectIndex", 1);
            intent.putExtra("type", 1);
            ArmsUtils.startActivity(intent);
            killMyself();
            EventBus.getDefault().post(EventBusTags.RELEASE_RENT_SEEKING_SUCCESS);
        });
    }

    @SuppressLint("SetTextI18n")
    @Override
    public void getDetailSuccess(RentSeekingDetail rentSeekingDetail) {
        hideLoading();
        if (rentSeekingDetail != null) {
            category = rentSeekingDetail.getSeekingType();
            seekingId = String.valueOf(rentSeekingDetail.getSeekingId());
            /* 设置发布请求参数 */
            if (AppUtil.userIsLogin(this)) {
                UserBean userBean = DataHelper.getDeviceData(this, AppConstant.USER_INFO);//获取用户信息
                assert userBean != null;
                reqParamsReleaseRentSeeking.setUserId(Long.parseLong(userBean.getUserId()));
            }
            reqParamsReleaseRentSeeking.setSeekingType(rentSeekingDetail.getSeekingType());
            reqParamsReleaseRentSeeking.setSeekingArea(rentSeekingDetail.getSeekingArea());
            reqParamsReleaseRentSeeking.setPositionDescription(rentSeekingDetail.getPositionDescription());
            reqParamsReleaseRentSeeking.setTenancy(rentSeekingDetail.getTenancy());
            reqParamsReleaseRentSeeking.setLowestRentBudget(rentSeekingDetail.getLowestRentBudget());
            reqParamsReleaseRentSeeking.setHighestRentBudget(rentSeekingDetail.getHighestAcreage());
            reqParamsReleaseRentSeeking.setRentTime(rentSeekingDetail.getRentTime());
            reqParamsReleaseRentSeeking.setEstimateRentingTime(rentSeekingDetail.getEstimateRentingTime());
            reqParamsReleaseRentSeeking.setEstimateRentingUnit(rentSeekingDetail.getEstimateRentingUnit());
            reqParamsReleaseRentSeeking.setDetailDesc(rentSeekingDetail.getDetailDesc());
            reqParamsReleaseRentSeeking.setLandlord(rentSeekingDetail.getLandlord());
            reqParamsReleaseRentSeeking.setLandlordGender(rentSeekingDetail.getLandlordGender());
            reqParamsReleaseRentSeeking.setLandlordMobile(rentSeekingDetail.getLandlordMobile());
            reqParamsReleaseRentSeeking.setWechatNumber(rentSeekingDetail.getWechatNumber());

            /* 填充详情数据 */
            tv_release_rent_seeking_type.setText(rentSeekingDetail.getSeekingTypeName());
            if (StringUtils.isEmpty(rentSeekingDetail.getParentSeekingAreaName())) {
                tv_release_rent_seeking_area.setText(rentSeekingDetail.getSeekingAreaName());
            } else {
                tv_release_rent_seeking_area.setText(rentSeekingDetail.getParentSeekingAreaName() + rentSeekingDetail.getSeekingAreaName());
            }
            et_release_rent_seeking_address_desc.setText(rentSeekingDetail.getPositionDescription());
            tv_release_rent_seeking_requirement.setText(rentSeekingDetail.getTenancyName());
            et_release_rent_seeking_min_price.setText(String.valueOf(rentSeekingDetail.getLowestRentBudget()));
            et_release_rent_seeking_max_price.setText(String.valueOf(rentSeekingDetail.getHighestRentBudget()));
            tv_release_rent_seeking_mouth.setText(rentSeekingDetail.getEstimateRentingUnitName());
            if (rentSeekingDetail.getTenancy().equals("short")) {
                tv_release_rent_seeking_price_util.setText(getString(R.string.release_rent_seeking_17));
                reqParamsReleaseRentSeeking.setTenancy("short");
                reqParamsReleaseRentSeeking.setEstimateRentingUnit("day");
                tv_release_rent_seeking_mouth.setText(getString(R.string.day));
            } else {
                tv_release_rent_seeking_price_util.setText(getString(R.string.release_rent_seeking_16));
                reqParamsReleaseRentSeeking.setTenancy("lasting");
                reqParamsReleaseRentSeeking.setEstimateRentingUnit("month");
                tv_release_rent_seeking_mouth.setText(getString(R.string.mouth));
            }
            tv_release_rent_seeking_move_into_date.setText(rentSeekingDetail.getRentTime().substring(0, 10));
            et_release_rent_seeking_lease_term.setText(String.valueOf(rentSeekingDetail.getEstimateRentingTime()));
            et_release_rent_seeking_house_desc.setText(rentSeekingDetail.getDetailDesc());
            et_release_rent_seeking_name.setText(rentSeekingDetail.getLandlord());
            setSexView(rentSeekingDetail.getLandlordGender());
            String[] mobile = ExtensionUtilKt.handleMobile(rentSeekingDetail.getLandlordMobile());
            tv_select_area_code.setText("+" + mobile[0]);
            et_release_rent_seeking_phone.setText(mobile[1]);
            et_release_rent_seeking_we_chat.setText(rentSeekingDetail.getWechatNumber());

            List<RentSeekingDetail.HouseRentDetailListBean> oldSelected = rentSeekingDetail.getHouseRentDetailList();
            if (oldSelected != null && oldSelected.size() > 0) {
                HousePayWayBean yqBean;
                for (int i = 0; i < oldSelected.size(); i++) {
                    yqBean = new HousePayWayBean();
                    yqBean.setDictId(oldSelected.get(i).getBaseDictId());
                    yqBean.setCategory(oldSelected.get(i).getCategory());
                    selectedYq.add(yqBean);
                }
            }

            switch (category) {
                case "zz":
                    reqParamsReleaseRentSeeking.setRoomCount(rentSeekingDetail.getRoomCount());
                    reqParamsReleaseRentSeeking.setDrawingCount(rentSeekingDetail.getDrawingCount());
                    reqParamsReleaseRentSeeking.setToiletCount(rentSeekingDetail.getToiletCount());
                    tv_release_rent_seeking_apartment.setText(rentSeekingDetail.getRoomCountName() + rentSeekingDetail.getDrawingCountName() + rentSeekingDetail.getToiletCountName());
                    break;
                case "hz":
                    reqParamsReleaseRentSeeking.setLowestAcreage(rentSeekingDetail.getLowestAcreage());
                    reqParamsReleaseRentSeeking.setHighestAcreage(rentSeekingDetail.getHighestAcreage());
                    tv_release_rent_seeking_acreage.setText(ExtensionUtilKt.appendAcreage(this, rentSeekingDetail.getLowestAcreage(), rentSeekingDetail.getHighestAcreage()));
                    break;
                case "bs":
                    reqParamsReleaseRentSeeking.setRoomCount(rentSeekingDetail.getRoomCount());
                    reqParamsReleaseRentSeeking.setDrawingCount(rentSeekingDetail.getDrawingCount());
                    reqParamsReleaseRentSeeking.setToiletCount(rentSeekingDetail.getToiletCount());
                    tv_release_rent_seeking_apartment.setText(rentSeekingDetail.getRoomCountName() + rentSeekingDetail.getDrawingCountName() + rentSeekingDetail.getToiletCountName());
                    break;
                case "bgs":
                    reqParamsReleaseRentSeeking.setLowestAcreage(rentSeekingDetail.getLowestAcreage());
                    reqParamsReleaseRentSeeking.setHighestAcreage(rentSeekingDetail.getHighestAcreage());
                    reqParamsReleaseRentSeeking.setAccommodationStation(rentSeekingDetail.getAccommodationStation());
                    tv_release_rent_seeking_acreage.setText(ExtensionUtilKt.appendAcreage(this, rentSeekingDetail.getLowestAcreage(), rentSeekingDetail.getHighestAcreage()));
                    et_release_rent_seeking_capacity.setText(String.valueOf(rentSeekingDetail.getAccommodationStation()));
                    break;
                case "sp":
                    reqParamsReleaseRentSeeking.setLowestAcreage(rentSeekingDetail.getLowestAcreage());
                    reqParamsReleaseRentSeeking.setHighestAcreage(rentSeekingDetail.getHighestAcreage());
                    tv_release_rent_seeking_acreage.setText(ExtensionUtilKt.appendAcreage(this, rentSeekingDetail.getLowestAcreage(), rentSeekingDetail.getHighestAcreage()));
                    break;
                case "cw":
                    break;
                case "cfck":
                    reqParamsReleaseRentSeeking.setLowestAcreage(rentSeekingDetail.getLowestAcreage());
                    reqParamsReleaseRentSeeking.setHighestAcreage(rentSeekingDetail.getHighestAcreage());
                    tv_release_rent_seeking_acreage.setText(ExtensionUtilKt.appendAcreage(this, rentSeekingDetail.getLowestAcreage(), rentSeekingDetail.getHighestAcreage()));
                    break;
            }
            getHouseRequirement(category);
        }
    }

    @Override
    public void showLoading() {
        loadingDialog.show();
    }

    @Override
    public void hideLoading() {
        loadingDialog.dismiss();
    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }
}
